package com.questionnaires.repository;

import com.questionnaires.exception.NotExistsException;
import com.questionnaires.exception.NotUniqueException;
import com.questionnaires.model.Category;

import java.util.List;

/**
 * Interface for the repository that handles category operations.
 *
 * @author rominamilea@gmail.com
 */

public interface CategoryRepository {

    /**
     * Adds or updates a category from database.
     *
     * @param category the category to be added or updated
     * @throws com.questionnaires.exception.NotUniqueException thrown if a category with the same name is added
     */
    void saveOrUpdate(Category category) throws NotUniqueException;

    /**
     * Removes the category with the specified id from database.
     *
     * @param id the category id to be deleted from database
     * @throws com.questionnaires.exception.NotExistsException thrown if the specified category does not exists in database
     */
    void delete(long id) throws NotExistsException;

    /**
     * Retrieves all categories from database.
     *
     * @return a list of all categories from database
     */
    List<Category> getCategories();

}
